﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrgPersTree_Index.aspx.cs" Inherits="Common_OrgPersTree_Index" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <table border="0" align="center" cellpadding="0" cellspacing="0" width= "98%" >	
  	<tr>
		<td>
	  		<iframe  id="district" height="530" width="100%" src="OrgPersTree.aspx?NodeCode=&OrgType=2&PageID=" frameborder="0" >浏览器不支持嵌入式框架，或被配置为不显示嵌入式框架。</iframe>
	  </td>
  	</tr>
	<tr> 
      <td>
      <table align="center" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td>
             <div align="center" > 
              <input name="btn_new_pd"  id="btn_new_pd" type="button" class="button02" onclick="tijiao()"  value="确定123" runat ="server" />              
              </div> </td> 
        </tr>
      </table>
	  </td>
    </tr>
</table>
<input type="hidden" id="Hcode" runat ="server"  />
<input type="hidden" id="HPageID" runat ="server"  />
<input type="hidden" id="HOrgType" runat ="server"  />
<input type="hidden" id="OrgIDInfo" runat ="server"  />
<input type="hidden" id="OrgNameInfo" runat ="server"  />
<input type="hidden" id="PersIDInfo" runat ="server"  /> 
<input type="hidden" id="PersNameInfo" runat ="server"  /> 
<input type="hidden" id="POPIDCol" runat ="server"  /> 
<input type="hidden" id="POPNameCol" runat ="server"  /> 
    </form>
    <script language ="javascript" type ="text/javascript" >
    var sData = dialogArguments;
    var sPageID = form1.HPageID.value;
    form1.POPIDCol.value = eval("sData.form1.HChoiceID_"+sPageID+".value");
    form1.POPNameCol.value = eval("sData.form1.ChoiceName_"+sPageID+".value");
    //alert(form1.POPIDCol.value);  
    
    function tijiao()
      {
        if((form1.OrgIDInfo.value == "" || form1.OrgIDInfo.value == null) && (form1.PersIDInfo.value == "" || form1.PersIDInfo.value == null))
        {
           var obj = dialogArguments;
           var sChoiceID = form1.HPageID.value ;
           var ChoiceNameInfo = "\"\"";
           var ChoiceIDInfo   = "\"\"";
           obj.sChoiceID = sChoiceID;
           obj.ChoiceNameInfo  = ChoiceNameInfo;
           obj.ChoiceIDInfo    = ChoiceIDInfo;
           window.returnValue  = obj;
           window.close();
        }
        else
        {
            var obj = dialogArguments;
            var iOrgNum = 0 ;
            var iPersNum = 0 ;
            var OrgNum = form1.OrgIDInfo.value.split(',');   //已选的部门ID的个数
            var PersNum = form1.PersIDInfo.value.split(',');   //已选的人员ID的个数
            if(form1.OrgIDInfo.value != "")
            {
                iOrgNum = OrgNum.length;
            }
            if(form1.PersIDInfo.value !="")
            {
                iPersNum = PersNum.length;
            }      
            
            var sChoiceID = form1.HPageID.value ;
            
            var AllowNum = eval("obj.iChoicePoNumber"+sChoiceID);// obj.iChoicePersNumber;
            if(AllowNum!="0")
            {
                if((iOrgNum*1+iPersNum*1)>AllowNum)
                {
                    alert("对不起,你选择的信息已超过"+AllowNum+"个");
                    return;
                }
            } 
            
            var ChoiceNameInfo = "\"" +  form1.PersNameInfo.value + "\"" ;
            var ChoiceIDInfo = "\"" + form1.PersIDInfo.value + "\"" ;            
            obj.sChoiceID = sChoiceID;
            obj.ChoiceNameInfo = ChoiceNameInfo;
            obj.ChoiceIDInfo = ChoiceIDInfo;
            window.returnValue = obj;
            window.close();
        }
     }     
     </script>
</body>
</html>
